import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SheetFormVO, SheetFormForm, SheetFormQuery } from '@/api/sheet/sheetForm/types';

/**
 * 查询表单管理列表
 * @param query
 * @returns {*}
 */

export const listSheetForm = (query?: SheetFormQuery): AxiosPromise<SheetFormVO[]> => {
  return request({
    url: '/system/sheetForm/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询表单管理详细
 * @param sheetFormId
 */
export const getSheetForm = (sheetFormId: string | number): AxiosPromise<SheetFormVO> => {
  return request({
    url: '/system/sheetForm/' + sheetFormId,
    method: 'get'
  });
};

/**
 * 新增表单管理
 * @param data
 */
export const addSheetForm = (data: SheetFormForm) => {
  return request({
    url: '/system/sheetForm',
    method: 'post',
    data: data
  });
};

/**
 * 修改表单管理
 * @param data
 */
export const updateSheetForm = (data: SheetFormForm) => {
  return request({
    url: '/system/sheetForm',
    method: 'put',
    data: data
  });
};

/**
 * 删除表单管理
 * @param sheetFormId
 */
export const delSheetForm = (sheetFormId: string | number | Array<string | number>) => {
  return request({
    url: '/system/sheetForm/' + sheetFormId,
    method: 'delete'
  });
};
